import axios from 'axios'

//获取模板素材
export function getCardTemplate(data) {
  const url = baseURL + 's=BlessCard/getCardTemplate'
  return axios.post(url,data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//获取背景素材
export function getBackgroundColor(data) {
  const url = baseURL + 's=BlessCard/getBackgroundColor';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//唤起图文模板
export function getWordTemplate(data) {
  const url = baseURL + 's=BlessCard/getWordTemplate';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//贺卡列表
export function CardTitle() {
  const url = baseURL + 's=BlessCard/CardTitle';
  return axios.post(url, {
    "phpsid": localStorage.getItem('token'),//session_id
  }, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//设置贺卡标题
export function addCardTitle(data) {
  const url = baseURL + 's=BlessCard/addCardTitle';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//贺卡编辑页初始化
export function editCardInit(data) {
  const url = baseURL + 's=BlessCard/editCardInit';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}
//贺卡详情页初始化
export function shareCardInit(data) {
  const url = baseURL + 's=BlessCard/shareCardInit';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//贺卡编辑上传
export function editCard(data){
  const url = baseURL+'s=BlessCard/editCard';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//初始化获取贺卡总数
export function cardTotal(){
  const url = baseURL+'s=User/cardTotal';
  return axios.post(url, {
    "phpsid":localStorage.getItem('token'), //session_id
  }, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}
//生成贺卡图片
export function CreateBlessCardPictrue(data){
  const url = baseURL+'s=Show/CreateBlessCardPictrue';
  return axios.post(url, data, {
    headers: {'Content-Type': 'multipart/form-data'}
  }).then(res => {
    return res.data;
  })
}

//删除贺卡图片
export function DeleteCardTitle(data){
  const url = baseURL+'s=BlessCard/DeleteCardTitle';
  return axios.post(url, data, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res => {
    return res.data;
  })
}

//实时保存贺卡修改信息
export function ImmediateEdit(data){
  const url = baseURL+'s=BlessCard/ImmediateEdit'
  return axios.post(url,data,{
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res=>{
    return res.data;
  })
}
//提示：我知道了
export function CancelTheGuide(data){
  const url = baseURL +'s=BlessCard/CancelTheGuide'
  return axios.post(url,data,{
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res=>{
    return res.data;
  })
}
//模板分类
export function GetBackClassification(data){
  const url = baseURL+'s=BlessCard/GetBackClassification'
  return axios.post(url,data,{
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  }).then(res=>{
    return res.data;
  })
}
